#include "opewidget.h"

OpeWidget::OpeWidget(QWidget *parent) : QWidget(parent)
{
   m_pflist = new QListWidget(this);
   m_pflist->addItem("好友");
   m_pflist->addItem("图书");
   m_pFriend = new Friend;
   m_pBook = new Book;
   m_pSW = new QStackedWidget;
   m_pSW->addWidget(m_pFriend);
   m_pSW->addWidget(m_pBook);

   QHBoxLayout* oPeraHBL = new QHBoxLayout;
   oPeraHBL->addWidget(m_pflist);
   oPeraHBL->addWidget(m_pSW);

   setLayout(oPeraHBL);

   connect(m_pflist,SIGNAL(currentRowChanged(int)),m_pSW,SLOT(setCurrentIndex(int)));


}

OpeWidget &OpeWidget::getinstance()
{
    static OpeWidget instance;
    return instance;
}

Friend *OpeWidget::getFriend()
{
    return m_pFriend;
}
